<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <button @click="swit">切换显示隐藏</button>
        <h1 v-show="flag">文本块</h1>
    </div>

    <script src="../lib/vue.js"></script>

    <script>
        const app = new Vue({
            el: "#app",
            data() {
                return {
                    flag: true
                }
            },
            methods: {
                // 所有methods中的函数，this都指向当前实例app
                swit() {
                    this.flag = !this.flag;
                }
            }

        })
    </script>
</body>
</html>